Skip to content

Conversation

@arturobernalg
Copy link
Member

Introduce Rfc6724AddressSelectingDnsResolver and unit tests.
Define INTERLEAVE as “no bias” (preserve RFC6724 order); keep ONLY/PREFER behavior unchanged.

Define INTERLEAVE as no-bias and align tests and debug output.
Copy link
Contributor

@rschmitt rschmitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main thing here is that I'd like to see a proper implementation of INTERLEAVE, more unit test coverage, and an example program we can use for manual testing.

InetAddress src = null;
try (final DatagramSocket s = new DatagramSocket()) {
s.connect(dest); // does not send packets; OS picks source addr/if
src = s.getLocalAddress();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want to inject a thing here that you can mock for unit testing purposes, e.g. a Function<InetSocketAddress, InetAddress> (or an equivalent that throws IOException).

Add manual gated IT to dump DEFAULT vs INTERLEAVE results.
Expand unit coverage for scope mapping and core RFC comparison rules.
@arturobernalg
Copy link
Member Author

@rschmitt Please do another pass. I think i solve all your remarks

import org.apache.hc.client5.http.SystemDefaultDnsResolver;
import org.apache.hc.client5.http.config.ProtocolFamilyPreference;

public final class Rfc6724ResolverExample {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/hc/client # ./run-example.sh Rfc6724ResolverExample www.amazon.com
Host: www.amazon.com
Preference: DEFAULT
  IPv6 2600:1409:9800:1680:0:0:0:3bd4
  IPv6 2600:1409:9800:168d:0:0:0:3bd4
  IPv4 184.27.192.135

src/hc/client # ./run-example.sh Rfc6724ResolverExample www.amazon.com INTERLEAVE
Host: www.amazon.com
Preference: INTERLEAVE
  IPv6 2600:1409:9800:168d:0:0:0:3bd4
  IPv4 184.27.192.135
  IPv6 2600:1409:9800:1680:0:0:0:3bd4

Neat! I'd be cool if I could see the before-and-after (maybe you could intercept the "before" by wrapping the system default resolver, then passing the wrapper in to the RFC 6724 resolver), but it's not essential.

@rschmitt
Copy link
Contributor

There are some things from my first review that still haven't been addressed. I suggest going through the comments one by one and hitting "Resolve conversation" as you address each one, so you can track what is and isn't done.

…ults.

Tighten resolver semantics and filtering for HTTP/TCP connect targets.
@arturobernalg
Copy link
Member Author

There are some things from my first review that still haven't been addressed. I suggest going through the comments one by one and hitting "Resolve conversation" as you address each one, so you can track what is and isn't done.

Hi @rschmitt I believe I’ve addressed all your remarks in the latest update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants